set :application, "trikr"
set :repository,  "http://pmsaas.googlecode.com/svn/trunk/"

set :deploy_to, "/home/trikr/app"
set :user, "trikr"
set :password, "trikr123"
set :use_sudo, false
set :mongrel_conf, "/home/trikr/app/current/"

role :app, "www.isungirl.com"
role :db, "www.isungirl.com"
role :web, "www.isungirl.com"

task :after_update_code, roles => [:app,:web] do
  run "cp #{release_path}/config/database.yml.pro #{release_path}/config/database.yml"
  run "ln -s #{release_path}/public/files  /home/trikr/app/shared/files "
  run "ln -s #{release_path}/public/fckeditor /home/trikr/app/shared/fckeditor" 
  run "ln -s #{release_path}/app/views/writeboards/wiki.rhtml #{release_path}/app/views/writeboards/save_wiki.rhtml"
  run "ln -s #{release_path}/app/views/permission/_sidebar.rhtml #{release_path}/app/views/people/_sidebar.rhtml"
  #run "mongrel_rails stop -c #{mongrel_conf}"  
  #run "mongrel_rails stop -c #{mongrel_conf}"  
  run "sleep 5"  
  #run "mongrel_rails start -d -eproduction -p7000 -c #{release_path}"  
end

task :stop, roles => [:app,:web] do
  run "mongrel_rails stop -c #{mongrel_conf}"  
end
task :start, roles => [:app,:web] do
  run "mongrel_rails start -d -eproduction -p7000 -c #{mongrel_conf}"  
end
task :orestart, roles => [:app,:web] do
  run "mongrel_rails stop -c #{mongrel_conf}"  
  run "cd #{mongrel_conf} && rake db:migrate "  
  run "mongrel_rails start -d -eproduction -p7000 -c #{mongrel_conf}"  
end

task :restart, roles => [:app,:web] do
  #run "mongrel_rails stop -c #{mongrel_conf}"  
  run "cd #{mongrel_conf}app && svn up "  
  run "cd #{mongrel_conf}public && svn up "  
  run "cd #{mongrel_conf}config && svn up "  
  run "cd #{mongrel_conf}vendor && svn up "  
  run "cd #{mongrel_conf}db && svn up "  
  run "cd #{mongrel_conf}lib && svn up "  
  #run "cd #{mongrel_conf} && rake db:migrate "  
  #run "cd #{mongrel_conf} && rake update:owner"  
  #run "ln -s /home/trikr/app/shared/fckeditor #{current_path}/public/fckeditor" 
 # run "sleep 2"  
  run "mongrel_rails restart -c #{mongrel_conf}"  
end

task :brestart, roles => [:bridge] do
  run "cap restart"
end
task :log, roles => [:app] do 
  run "tail -f #{mongrel_conf}log/production.log "  
end

